<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>菜单管理</title>
<jsp:include page="../addlink.jsp" />
<meta charset="utf-8" />
<meta name="renderer" content="webkit">
<link rel="stylesheet" type="text/css"	href="${pageContext.request.contextPath}/statics/css/common.min.css">
<link rel="stylesheet" type="text/css"	href="${pageContext.request.contextPath}/statics/lib/treeTable/themes/vsStyle/treeTable.min.css">
<script type="text/javascript"	src="${pageContext.request.contextPath}/statics/lib/treeTable/jquery.treeTable.js"></script>
<script type="text/javascript">
	$(function() {
		$("#userListTable").treeTable({
			expandLevel : 3
		}).show(); 
	});

	var deptMgr = {

		delDept : function(deptId) {
			if (confirm("您确定要删除此菜单吗?")) {
				$.ajax({
					type : 'post',//请求方式
					url : '${basePath}/sys/dept/delDept',
					dataType : 'json', //有几种格式 xml html json text 等常用
					//data传值的另外一种方式 form的序列化
					data : {
						"deptId" : deptId
					},//传递给服务器的参数				
					success : function(data) {//与服务器交互成功调用的回调函数
						if(data.code == 200){
							setTimeout(function(){
								window.location.href = "${basePath}/sys/dept/toDeptList"
							},1000);
							zxTips_short({txt:data.message});
						}
					}
				});
			}
		}
	};
</script>
<style>
#userListTable td{max-width: 175px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
</style>
</head>
<body>
	<jsp:include page="../head.jsp" />
	<div class="container-fluid all">
		<jsp:include page="../menu.jsp" />
		<div class="maincontent">
			<ol class="breadcrumb">
				<li class="url-root"><a>部门管理</a></li>
				<li class="active">部门列表</li>
			</ol>
			<div class="control_bar row">
				<div class="control_left">
					<a class="btn btn-default"
						href="${basePath}/sys/dept/toDeptEdit?editFlag=1" role="button">添加</a>
				</div>
			</div>
			<div class="mode">
				<table class="table table-hover" id="userListTable">
					<thead>
						<tr>
							<th>机构号</th>
							<th>名称</th>
							<!-- <th>类型</th> -->
							<th>级别</th>
							<!-- <th>管理机构</th> -->
							<th>城市代码</th>
							<th>地址</th>
							<th>邮编</th>
							<th>电话</th>
							<th>SWIFT号</th>
							<th>机构管理级别</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${deptList}" var="dept">
							<tr id="${dept.branCode}" pid="${dept.admBranCode}">						
								<td>${dept.branCode}</td>
								<td>${dept.branName}</td>
								<%-- <td>${dept.branType}</td> --%>
								<td>
									<c:if test="${dept.branLevel eq 0}">总行</c:if>
									<c:if test="${dept.branLevel eq 1}">分行</c:if>
									<c:if test="${dept.branLevel eq 2}">支行</c:if>
								</td>
								<%-- <td>${dept.admBranCode}</td> --%>
								<td>${dept.cityCode}</td>
								<td title="${dept.othAddress}">${dept.othAddress}</td>
								<td>${dept.postCode}</td>
								<td>${dept.phoneNo}</td>
								<td>${dept.swiftNo}</td>
								<td>
									<c:if test="${dept.branMgnLevel eq 10}">总行</c:if>
									<c:if test="${dept.branMgnLevel eq 11}">总行直属机构</c:if>
									<c:if test="${dept.branMgnLevel eq 20}">分行</c:if>
									<c:if test="${dept.branMgnLevel eq 21}">分行直属机构</c:if>
									<c:if test="${dept.branMgnLevel eq 30}">支行</c:if>
									<c:if test="${dept.branMgnLevel eq 31}">支行直属机构</c:if>
								
								</td>
								<td nowrap><a
									href="${basePath}/sys/dept/toDeptEdit?editFlag=2&deptId=${dept.id}">修改</a>
									<%-- <a href="javascript:deptMgr.delDept(${dept.id})">删除</a>  --%>
									<a href="${basePath}/sys/dept/toDeptEdit?editFlag=1&parentId=${dept.id}">添加下级部门</a>
								</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
		</div>
	</div>
	<jsp:include page="../foot.jsp" />
</body>
</html>